home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16036 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: ix.netcom.com!news
  2. From: jhewett@ix.netcom.com (Jerry Hewett)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: const FAR* for a DLL
  5. Date: Mon, 08 Apr 96 16:32:54 GMT
  6. Organization: Netcom
  7. Message-ID: <N.040896.093254.68@ix.netcom.com>
  8. References: <828873144.24425@uribe.demon.co.uk>
  9. NNTP-Posting-Host: tem-ca1-18.ix.netcom.com
  10. X-NETCOM-Date: Mon Apr 08 11:33:25 AM CDT 1996
  11. X-Newsreader: Quarterdeck Message Center [2.00]
  12.  
  13. > Below is an exctract from a DLL I am trying to write. The 2nd parameter
  14. > for FillRect is defined in windows.h as const RECT FAR*  Could somebody
  15. > PLEASE tell me how to set it up - I've tried everything I can think of,
  16. > plus a few suggestions from others with no success so far.
  17.  
  18. Try this (I didn't compile/test it, but it should work :-)
  19.  
  20. ----<snip>----
  21.  
  22. int FAR PASCAL _export myShow(int dest)
  23. {             
  24.     RECT    rc;
  25.     int     i;
  26.     long    colour;
  27.     BYTE    bRed,bGrn,bBlu;
  28.  
  29.     // colour below is assumed to be GREEN; 0x0000FF00 (page 101)
  30.  
  31.     colour = 0xFF00;
  32.  
  33.     // mask colour out to BGR byte values (page 101)
  34.  
  35.     bBlu = (BYTE) (colour & 0xFF0000);
  36.     bGrn = (BYTE) (colour & 0x00FF00);
  37.     bRed = (BYTE) (colour & 0x0000FF);
  38.  
  39.     // set up a 100x100 rectangle at 10,10 (page 153)
  40.  
  41.     rc.left   = 10;
  42.     rc.top    = 10;
  43.     rc.right  = 100;
  44.     rc.bottom = 100;
  45.  
  46.     // ...assuming that "dest" is a handle to a device context (page 155)
  47.  
  48.     i = FillRect (dest,&rc,CreateSolidBrush (RGB (bRed,bGrn,bBlu)));
  49.  
  50.     return i;
  51. }
  52.  
  53. ----<snip>----
  54.  
  55. At the risk of sounding like a parrot or paid flunky of MS Press (which I'm 
  56. not), pick up a copy of Charles Petzold's _Programming Windows 95_.  You'll 
  57. never regret it.  The information above was culled from pages 101 and 151-156 
  58. of _PW95_.
  59.  
  60. Jerry H.
  61.  
  62.  
  63.